package com.example.my2lcache.utils;

/**
 * id生成工具
 *
 * @author huhao
 */
public class IdUtils {


    /**
     * 生成缓存ID
     *
     * @param category 类型
     * @param key      键
     * @return 缓存Key，如："category:key"
     */
    public static String generateKey(String category, String key) {
        if (category == null || category.trim().isEmpty()) {
            throw new RuntimeException("category is null");
        }
        if (key == null || key.trim().isEmpty()) {
            throw new RuntimeException("key is null");
        }
        return category + ":" + key;
    }
}
